package com.czy.utilslib.viewModel;

import androidx.annotation.NonNull;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.Observer;

public class BaseMutableLiveData<T> extends MutableLiveData<T> {

    public BaseMutableLiveData(T value) {
        super(value);
    }

    public BaseMutableLiveData() {
    }

    // 重写防止多次观察
    @Override
    public void observe(@NonNull LifecycleOwner owner, @NonNull Observer<? super T> observer) {
        if(this.getValue() == null){
            super.observe(owner, observer);
        }
    }
}
